Device and method for converting a diagnostic interface to spi standard

ABSTRACT

The device described is used to convert a diagnostic interface to standard SPI and includes:  
     an electronic unit ( 10 ), having a data input ( 14 ), a data output ( 17 ), a synchronization input ( 15 ), a clock input ( 16 ) and a register ( 13 ) and  
     a buffer unit ( 12 ), having a signal input ( 19 ), a signal output ( 20 ) and an activation input ( 21 ).  
     The data input ( 14 ) and the data output ( 17 ) of the electronic unit ( 10 ) are connected to each other by a first data line ( 18 ). The data output ( 17 ) for the electronic unit ( 10 ) is connected to the signal input ( 19 ) on the buffer unit ( 12 ) by a second data line ( 22 ).

[0001] The invention relates to a device and a method for converting a diagnostic interface to standard SPI.

BACKGROUND INFORMATION

[0002] Control units in motor vehicles are used, for example, to activate ignition end stages external to the control unit. To this end, the control units are ordinarily controlled by a microprocessor. To ensure faultless operation, it is necessary to implement a watchdog function, i.e., to read out and analyze status reports or diagnostic information from the control unit and to initiate appropriate measures, if necessary.

[0003] A device for monitoring a motor vehicle testing system is known from German Patent Application 40 32 926 A1. This device includes a testing device and a portable diagnostic unit, which may be interconnected via an interface. Moreover, a monitoring device is provided, which may be connected to the testing device via the interface instead of the diagnostic device.

[0004] The device described is a simple device for monitoring a motor vehicle system. It makes it possible for the user to obtain information concerning whether a fault is present in the diagnostic device or within the testing device.

[0005] A device for monitoring the function of an electrical switch designed as an end stage, its connected consumer, its activation, and the associated connecting lines is described in European Patent 0 477 309 B1.

[0006] The device has at least one fault detection logic connected parallel to the end stage. A reference potential is applied to the connecting point between the switch and the consumer. In addition, the potentials of the input and output terminals of the end stage as well as the reference potential may be applied to the fault detection logic. Based on the applied potentials, the fault detection logic differentiates between faults such as short-circuit to positive terminal, load shedding, and short-circuit to ground. Moreover, a supplementary circuit is provided for the storage of the fault status and for a control unit to input a fault log.

[0007] The device described makes it possible to differentiate reliably between possible fault cases such as short-circuit to ground, short-circuit to positive terminal and load shedding. Proper function of the consumer and its activation are also recognized.

[0008] Up to now, in the event of a short-circuit or load shedding of the electronic units or ICs (primarily end stages) contained in control units, it has been possible to read out the diagnostic information via a serial interface.

[0009] The conventional diagnostic interface (DI) has a data input, a data output, an input for the clock signal (CLK), and an input for synchronization (SYNC). The communication between the microcontroller and the electronic unit via this interface required the setting and erasing or reading out from ports.

[0010] The SPI interface (serial peripheral interface) now makes communication possible, for example, between a microprocessor and an electronic unit such as an IC.

[0011] The communication begins with the microprocessor setting a synchronization input of the electronic unit using a slave select (SS). Ordinarily, the synchronization input “low” is set to start the communication.

[0012] The clock signal (CLK) used to synchronize the data transmission is then applied. The data input of the electric unit is identified as MOSI (master out slave in) and the data output as MISO (master in slave out).

[0013] In contrast to the diagnostic interface, the SPI interface is supported by microcontrollers or microprocessors. Sending and receiving is accomplished by writing into and reading from registers.

[0014] The operation of the diagnostic interface results either in the programming of wait loops in order to observe the bit times or a function procedure call per bit in the case, for example, of operation in the 1 ms pattern. This ties up a very large amount of microprocessor resources, which should be avoided, of course.

[0015] If, however, it is desired to utilize the advantages of SPI, this means that it may be necessary to redesign ICs in control units. For ICs for which there is no reason for redesigning except for the interface, this appears to be very expensive. The present invention proceeds from this point.

ADVANTAGES OF THE INVENTION

[0016] The diagnostic interface used is located in the control unit and, in the case of a fault, is used to assist the workshop entrusted with a repair in eliminating the fault. Furthermore, it is possible to respond to faults even while driving. Faults detected are, for example, fuel injection faults. It is thus possible, for example, to suppress the gasoline injection for one cylinder if it is determined that no ignition spark is generated for that cylinder. Another possibility is to suppress lambda regulation.

[0017] For this purpose, the diagnostic interface has a data input, a data output, an input for the clock signal and an input for synchronization.

[0018] The log of the diagnostic interface is very similar to the log of the SPI interface. Thus, the synchronization line (SYNC) is used with the diagnostic interface or the slave select signal (SS) is used with the SPI interface to address the module, and the diagnostic registers are stored or output. In SPI, the data output of the diagnostic interface sends the data to the microprocessor, as in the case of MISO.

[0019] The data input of the diagnostic interface is different, however, from the MOSI of the SPI interface. While the data input of the diagnostic interface is used to cascade different slave modules, MOSI should be used to write data from the microprocessor to the slave module or modules. This function was not available with modules having the diagnostic interface.

[0020] According to the present invention, the differences between the diagnostic interface and SPI are taken into consideration, as is explained below.

[0021] If a line fault is recognized (short-circuit, load shedding), the data output is moved to “low” in ICs having a diagnostic interface. In ICs having SPI, the output may only be active, i.e., “low” or “high” if the module is addressed via SS. For that reason, a buffer unit is connected at the data output of the electronic unit. The output then becomes tristate or active via a disable signal or an activation signal. The activation input or switching input of the buffer unit is used for this purpose.

[0022] The output in the case of ICs having a diagnostic interface is an open collector. Therefore, a pullup resistor must be provided at the data output of the electronic unit if the logic level at the data input is not adequate or not present for reasons having to do with the baud rate.

[0023] The SPI interface is customarily designed for 2 to 5 Mbaud. Many ICs having a diagnostic interface are only designed for 500 kbaud. For that reason, when accessing the diagnostic interface, it may be necessary to switch over the baud accordingly.

[0024] In the case of the diagnostic interface, setting the SYNC outputs the first data bit. In SPI, this does not occur until the clock flank. This means that when converting to SPI, the first data bit is lost. Therefore, the data output must be given to the data input. The cascading then causes the lost data bit to be sent at the end. The microprocessor must shift the received string by 1 bit or analyze the bits accordingly.

[0025] When a plurality of slave modules is cascaded, the data output of the last module which is connected to MISO must be supplied to the data input of the first slave module.

[0026] The device according to the present invention for converting a diagnostic interface to standard SPI has an electronic unit, for example, an IC of a control unit and a buffer unit. The electronic unit has a data input, a data output, a synchronization input, a clock input and a register, preferably a shift register. The diagnostic information intended to be read out is stored in the register.

[0027] The buffer unit has a signal input, a signal output and an activation input.

[0028] The data input and the data output of the electronic unit are interconnected via a first data line. The data output of the electronic unit is connected to the signal input of the buffer unit via a second data line.

[0029] The supplementary circuitry makes it possible for the electronic unit having a conventional diagnostic interface to be connected to the SPI interface of a microcontroller.

[0030] In a preferred embodiment of the device according to the present invention, the synchronization input of the electronic unit and the activation input of the buffer unit are interconnected via a third data line. It is thus possible to set both inputs simultaneously by applying a signal using the microprocessor.

[0031] If for reasons of the baud rate, the pullup, i.e., the logic level is not adequate or is not present at the data input of the electronic unit, it is preferred that a pullup resistor be connected at the data output since the data output is an open collector.

[0032] In the device according to the present invention, it is advantageous in particular that it is cascadable. When a plurality of slave modules is cascaded, the data output of the last slave module is supplied to the data input of the first slave module.

[0033] The method according to the present invention of converting a diagnostic interface to standard SPI may be implemented using a device as described above and a microprocessor.

[0034] Initially, the microprocessor sets the synchronization input of the electronic unit and the activation input of the buffer unit, i.e., the microprocessor applies an active signal to these inputs. Advantageously, the inputs are interconnected so that one signal of the microprocessor sets the two addressed inputs simultaneously.

[0035] In addition, a clock signal is applied to the clock input of the electronic unit. The data in the shift register is stored or output, synchronized with this clock signal.

[0036] The data is then output from the shift register via the buffer unit, which is activated, and input from the microprocessor via the MISO.

[0037] The first data bit is supplied by the first data output to the data input via the first data line and is thus sent at the end. The microprocessor accordingly analyzes the read out data bits by shifting the received string by 1 bit, for example.

[0038] The supplementary circuit makes it possible to connect ICs to the SPI interface using the conventional diagnostic interface.

[0039] It is thus possible to continue to use ICs for which, except for the interface, there is no reason to redesign them.

[0040] If the electronic unit is designed for a baud rate which does not correspond to that of the SPI interface of the microprocessor, the baud rate is advantageously switched over accordingly by the microprocessor.

[0041] A computer program according to the present invention includes all program code means needed to execute all steps of the method according to the present invention. The computer program may be stored on suitable data media such as EEPROMS, flash memories or even CD-ROM, diskettes or hard disk drives. The computer program is run by an electronic central processing unit, the microprocessor, for example, in this case.

DRAWINGS

[0042] The present invention will be explained in greater detail with reference to a preferred exemplary embodiment using the appended drawing. In the drawing:

[0043]FIG. 1 shows a preferred embodiment of the device according to the present invention in a schematic depiction, and

[0044]FIG. 2 shows a preferred embodiment of the method according to the present invention in the form of a flowchart.

[0045]FIG. 1 shows a device according to the present invention in a schematic depiction. It is possible to see an electronic unit identified in its entirety as 10, a pullup resistor 11 and a buffer unit 12. Electronic unit 10 is used to activate ignition end stages external to the control unit. In this case, it is not necessary to send data from the microprocessor to electronic unit 10. In the system shown, diagnostic data of electrical unit 10 which is stored in electronic unit 10 in a diagnostic register 13, typically a shift register, should be read out via the SPI.

[0046] To utilize the advantages of SPI for reading out from the diagnostic register, it would only be necessary to redesign electronic unit 10 only because of the interface. In addition to development costs, costs arise through administration of a second type identification number and the number of different units.

[0047] In this case, a single gate may be used as buffer unit 12. If needed at all, pullup resistor 11 should be in the range of 10 kOhm as a function of the desired baud rate.

[0048] Electronic unit 10 has a data input 14, a synchronization input 15, a clock input 16 and a data output 17. Data output 17 is connected to data input 14 via a first data line 18. Pullup resistor 11 is provided at data output 17, the pullup resistor being connected between data output 17 and supply voltage VCC.

[0049] Furthermore, electronic unit 10 has a series of inputs, which are identified here as IN1 through IN6, and a series of outputs, which are identified here as OUT1 through OUT6. The inputs are used to communicate with the microprocessor. They represent a parallel interface. The outputs are used, for example, to activate ignition end stages.

[0050] Buffer unit 12 has a signal input 19, a signal output 20 and an activation input 21.

[0051] Signal input 19 of buffer unit 12 is connected to data output 17 of electronic unit 10 via a second data line 22. Activation unit 21 is connected to synchronization input 15 of electronic unit 10 via a third data line 23.

[0052] Signal output 20 is used as MISO. This means that the diagnostic data of the electronic unit is read out via signal output 20.

[0053] The method according to the present invention is shown in FIG. 2 in the form of a flowchart.

[0054] Synchronization input 13 is set in a first step 30. As a result, electronic unit 10 is addressed and buffer unit 12 is activated at the same time.

[0055] In a subsequent step 31, a clock signal is applied. This is used to synchronize the data input and data output.

[0056] In a further step 32, the data bits are output via MISO, the first data bit being output last.

[0057] In a subsequent step 33, the data bit that represents diagnostic information is analyzed by the microprocessor.

[0058] The use of the SPI interface by ICs having a standard interface proves to be advantageous. It is thus possible to utilize the hardware support of the SPI interface. In addition, it is possible to save pins on the microprocessor.

[0059] It is a particular advantage that it is possible to continue to use ICs having a conventional diagnostic interface if there are no other functional reasons that would make it necessary to redesign the IC. 

What is claimed is:
 1. A device for converting a diagnostic interface to standard SPI, comprising: an electronic unit (10), having a data input (14), a data output (17), a synchronization input (15), a clock input (16) and a register (13), and a buffer unit (12), having a signal input (19), a signal output (20) and an activation input (21), the data input (14) and the data output (17) of the electronic unit (10) being interconnected via a first data line (18), and the data output (17) of the electronic unit (10) being connected to the signal input (19) of the buffer unit (12) via a second data line (22).
 2. The device as recited in claim 1, wherein the synchronization input (15) of the electronic unit (10) and the activation input (21) of the buffer unit (12) are interconnected via a third data line (23).
 3. The device as recited in claim 1 or 2, wherein a pullup resistor (11) is connected at the data output (17) of the electronic unit (10).
 4. The device as recited in one of claims 1 through 3, wherein it is cascadable using devices of the same type.
 5. A method for converting a diagnostic interface to standard SPI using a device as recited in one of claims 1 through 4 and a microprocessor, in which the microprocessor first sets the synchronization input (15) of the electronic unit (10) and the activation input (21) of the buffer unit (12), feeds a clock signal to the clock input (16) of the electronic unit (10) and subsequently reads out, via the signal output (20) of the buffer unit (12), a number of data bits which were stored in the register (13) of the electronic unit (10), a first data bit being supplied from the data output (17) to the data input (14) via the first data line (18) and thus being sent at the end, and the microprocessor analyzing the read-out data bits accordingly.
 6. The method as recited in claim 5, wherein the baud rate is switched over.
 7. A computer program comprising program code means in order to execute all steps of claim 5 when the computer program is run on a computer or a corresponding central processing unit, a microprocessor in particular.
 8. A computer program product comprising program code means that are stored on a computer-readable data medium in order to execute the method according to claim 5 when the computer program is run on a computer or a corresponding central processing unit, a microprocessor in particular. 